package cn.xjt.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * 内容：
 *
 * @author
 * @date 2020/9/21-14:04
 */

@Controller
@RequestMapping("h1")
public class HelloController {

//	@RequestMapping(value = "/hello/{a}/{b}",method = RequestMethod.GET)
	@GetMapping("/hello/{a}/{b}")
	public String test(@PathVariable int a,@PathVariable int b, Model model)
	{
		int res= a+b;
		model.addAttribute("msg", "结果为："+res);

		return "hello";
	}

	@RequestMapping("/index")
	public String index()
	{
		return "redirect:/index.jsp";
	}
}
